<script>
    $(document).ready(function(){
    $('.loading').fadeOut();
    {% if request.user.is_superuser %}
      $("li").each(function(){
        if($(this).attr('id')){
            $(this).css('display','block');
        }
      });
      $("a").each(function(){
        if($(this).attr('id')){
            $(this).css('display','block');
        }
      });
      $("button").each(function(){
        if($(this).attr('id')){
            $(this).css('display','block');
        }
      });
    {% else %}
        $.get('/accounts/permission/user_permission/',function(data){
            if (data) {
                var obj = data.split(",");
                var x;
                for (x in obj) {
                  $("a").each(function(){
                    if($(this).attr('id') == obj[x]){
                        $(this).css('display','block');
                    }
                  });
                  $("li").each(function(){
                    if($(this).attr('id') == obj[x]){
                        $(this).css('display','block');
                    }
                  });
                  $("button").each(function(){
                    if($(this).attr('id') == obj[x]){
                        $(this).css('display','block');
                    }
                  });

                }
            }
        });
    {% endif %}
});
</script>
<aside class="main-sidebar">

    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
    <div style="height: 20px">

    </div>
      <!-- Sidebar user panel (optional) -->
      <!-- /.search form -->

      <!-- Sidebar Menu -->

      <ul class="sidebar-menu" id="sidebar-menu">
        <li id="navilist" style="display: none"><a href="{% url 'navi' %}"><i class="fa fa-link"></i> <span>站点导航</span></a></li>
        <li class="treeview" id="cmdb" style="display: none">
          <a href="#"><i class="fa fa-database"></i> <span>资产管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
              <li id="asset" style="display: none"><a href="{% url 'cmdb' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;主机管理</span></a></li>
              <li id="idc" style="display: none"><a href="{% url 'idc' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;机房管理</span></a></li>
              <li id="cabinet" style="display: none"><a href="{% url 'cabinet' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;机柜管理</span></a></li>
              <li id="group" style="display: none"><a href="{% url 'group' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;属组管理</span></a></li>
          </ul>
        </li>
        <li class="treeview" id="appconf" style="display: none">
          <a href="#"><i class="fa fa-outdent"></i> <span>应用管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li id="product" style="display: none"><a href="{% url 'product_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;产品线管理</span></a></li>
            <li id="project" style="display: none"><a href="{% url 'project_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;工程管理</span></a></li>
            <li id="appowner" style="display: none"><a href="{% url 'appowner_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;人员管理</span></a></li>
            <li id="authinfo" style="display: none"><a href="{% url 'authinfo_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;认证中心</span></a></li>
          </ul>
        </li>
        <li class="treeview" id="branches" style="display: none">
          <a href="#"><i class="fa fa-building"></i> <span>分支管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li id="region" style="display: none"><a href="{% url 'region_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;区域管理</span></a></li>
            <li id="branch" style="display: none"><a href="{% url 'branch_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;分支机构</span></a></li>
            <li id="resource" style="display: none"><a href="{% url 'resource_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;资源管理</span></a></li>
          </ul>
        </li>
        <li class="treeview" id="setup" style="display: none">
          <a href="#"><i class="fa fa-cogs"></i> <span>任务管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li id="joblist" style="display: none"><a href="{% url 'job_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;Crontab</span></a></li>
            <li id="ansible" style="display: none"><a href="{% url 'ansible' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;Ansible</span></a></li>
            <li id="shell" style="display: none"><a href="{% url 'shell' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;Shell</span></a></li>
          </ul>
        </li>
        <li id="delivery" style="display: none"><a href="{% url 'delivery_list' %}"><i class="fa fa-retweet"></i> <span>持续交付</span></a></li>
        <li class="treeview" id="monitor" style="display: none">
          <a href="{% url 'monitor' %}"><i class="fa fa-television"></i> <span>监控平台</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li id="system" style="display: none"><a href="{% url 'monitor' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;系统监控</span></a></li>
            <li id="manage" style="display: none"><a href="{% url 'monitor_manage' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;监控管理</span></a></li>
{#            <li id="alert" style="display: none"><a href="#"><span>&nbsp;&nbsp;&nbsp;&nbsp;报警管理</span></a></li>#}
          </ul>
        </li>
        <li id="mfile" style="display: none"><a href="{% url 'mfile' %}"><i class="fa fa-folder-open"></i> <span>文件管理</span></a></li>
        <li class="treeview" id="accounts" style="display: none">
          <a href="#"><i class="fa fa-users"></i> <span>用户管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li id="userlist" style="display: none"><a href="{% url 'user_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;用户管理</span></a></li>
            <li id="rolelist" style="display: none"><a href="{% url 'role_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;角色管理</span></a></li>
            <li id="permlist" style="display: none"><a href="{% url 'permission_list' %}"><span>&nbsp;&nbsp;&nbsp;&nbsp;权限管理</span></a></li>
          </ul>
        </li>
        <li id="config" style="display: none"><a href="{% url 'config' %}"><i class="fa fa fa-cog"></i> <span>系统配置</span></a></li>
{#          {% endif %}#}
      </ul>
      <!-- /.sidebar-menu -->
    </section>
    <!-- /.sidebar -->
  </aside>